/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package chars;

import java.io.File;
import javax.imageio.ImageIO;

/**
 *
 * @author dylan
 */
public class mine extends hittable {

    boolean exploded;

    public mine(int x, int y) {
        super(x, y);
        exploded = false;
        try {
            setImage(ImageIO.read(new File("Images/objects/mine.png")));
        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
    }

    public void explode() {
        exploded = true;
        try {
            setImage(ImageIO.read(new File("Images/objects/mineExp.png")));
            x -= 5;
            y -= 2;
        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
    }

    public boolean checkCollision(Player player) {
        if (super.checkCollision(player)) {
            if (!exploded){
                explode();
            }
            return true;
        }
        return false;
    }

    public void act(platformer.Manager manager) {
        manager.player.die();
    }
}
